<?php
//рус
include_once(_CORE_PATH. "libs/MozgDB.php");
class MozgSource_Default extends MozgDB
{
	protected $_tablePrefix = 'mozg';
	
    public function __construct ()
    {   
    	$dbCreds = MozgCfg::GetProp('global//db');
    	
        try {

			$initCommand = "SET NAMES " .$dbCreds['charset']. ", time_zone = '" .SysLoader::GetLibCollection()->date->getTimezoneOffset(). "'";
        	
	        parent::__construct('mysql:host=' .$dbCreds['host']. ';dbname=' .$dbCreds['name']. ';', 
	                            $dbCreds['user'], 
	                            $dbCreds['pass'],
	                            array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
	                                    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
	                                    PDO::MYSQL_ATTR_INIT_COMMAND => $initCommand));  

        }  
        catch (PDOException $e) {
		    echo "Ошибка при соединении с базой: " . $e->getMessage() . "\n";
		    exit;        
        }                     
    }
}    
    
